﻿using System.Windows;
using appDataContracts;

namespace appSupplier
{
    /// <summary>
    /// Logique d'interaction pour CommandDetailWindow.xaml
    /// </summary>
    public partial class CommandDetailWindow : Window
    {
        private SerializedOrderLine orderLine;

        public CommandDetailWindow(SerializedOrderLine orderLine)
        {
            InitializeComponent();
            this.orderLine = orderLine;

            #region replissage des labels

            lblClientInfos.Content = string.Format("{0} {1} <{2}>", orderLine.CLIENT.CLIENTFIRSTNAME, orderLine.CLIENT.CLIENTLASTNAME, orderLine.CLIENT.CLIENTMAIL);
            lblAddress.Content = orderLine.CLIENT.CLIENTADRESS;
            lblCity.Content = orderLine.CLIENT.CLIENTZIP + " " + orderLine.CLIENT.CLIENTCITY + ", " + orderLine.CLIENT.CLIENTCOUNTRY;

            lblNumOrder.Content = orderLine.ORDER.ORDERID;

            lblProductName.Content = orderLine.PRODUCT.PRODUCTNAME;
            lblProductNum.Content = orderLine.PRODUCT.PRODUCTID;

            lblDate.Content = orderLine.ORDER.ORDERDATE.ToShortDateString();

            lblQuantity.Content = orderLine.ARTICLE.CONTAINQUANTITY.ToString();
            lblPrice.Content = orderLine.PRODUCT.PRODUCTPRICE;

            lblTotal.Content = (orderLine.ARTICLE.CONTAINQUANTITY * orderLine.PRODUCT.PRODUCTPRICE).ToString();

            #endregion
        }

        private void btClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
